<?php
/**
 * User: aka
 * Date: 2018/6/24
 * Time: 23:11
 */

namespace app\backstage\controller;

class Manage extends Admin
{
    private function findData(string $dbName) : array
    {
        $findData = db($dbName)->where(['id'=>1])->find();
        return $findData;
    }

    private function fieldData(string $dbName,string $field) : array
    {
        $fieldData = db($dbName)->where(['id'=>1])->field($field)->find();
        return $fieldData;
    }

    private function selectData(string $dbName) : array
    {
        $selectData = db($dbName)->select();
        return $selectData;
    }

    public function homeView()
    {
        return view('home');
    }

    public function enterprisePhoneView()
    {
        $numberData = $this->findData('enterprise_phone');
        return view('enterprisePhone',['numberData'=>$numberData]);
    }

    public function contactAddressView()
    {
        $enterpriseData = $this->findData('enterprise_address');
        return view('contactAddress',['enterpriseData'=>$enterpriseData]);
    }

    public function enterpriseCooperationView()
    {
        $enterpriseCooperationData = $this->fieldData('enterprise_info','enterprise_cooperation');
        return view('enterpriseCooperation',['articleData'=>$enterpriseCooperationData]);
    }

    public function enterpriseRecoveryView()
    {
        $enterpriseRecoveryData = $this->fieldData('enterprise_info','enterprise_recovery');
        return view('enterpriseRecovery',['articleData'=>$enterpriseRecoveryData]);
    }

    public function aboutUsView()
    {
        $aboutUsData = $this->fieldData('enterprise_info','about_us');
        return view('aboutUs',['articleData'=>$aboutUsData]);
    }

    public function processFlowView()
    {
        $processFlowData = $this->fieldData('enterprise_info','process_flow');
        return view('processFlow',['articleData'=>$processFlowData]);
    }

    public function mattersNeedingAttentionView()
    {
        $mattersNeedingAttentionData = $this->fieldData('enterprise_info','matters_needing_attention');
        return view('mattersNeedingAttention',['articleData'=>$mattersNeedingAttentionData]);
    }

    public function exemptionFromDepositView()
    {
        $exemptionFromDepositData = $this->fieldData('enterprise_info','exemption_from_deposit');
        return view('exemptionFromDeposit',['articleData'=>$exemptionFromDepositData]);
    }

    public function ercodeView()
    {
        return view('ercode');
    }

    public function sowingImgManageView()
    {
        $sowingData = $this->selectData('sowing_img');
        return view('sowingImgManage',['sowingData'=>$sowingData]);
    }

    public function sowingImgAddView()
    {
        return view('sowingImgAdd');
    }

    public function sowingImgEditView()
    {
        $urlData = $this->getRequestOperation()->getAllRequestParam();
        return view('sowingImgEdit',['imgId'=>$urlData]);
    }

    public function changeUserPasswordView()
    {
        return view('changeUserPassword');
    }
}